﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography;

namespace SGQ.Util
{
    class Criptografia
    {
        public static string getMD5Hash(string input) {
            try
            {
                MD5 md5 = MD5.Create();
                byte[] data = md5.ComputeHash(System.Text.Encoding.Default.GetBytes(input));
                System.Text.StringBuilder sbString = new System.Text.StringBuilder();
                for (int i = 0; i < data.Length; i++)
                    sbString.Append(data[i].ToString("x2"));
                return sbString.ToString();
            }
            catch (Exception e) {
                throw new Exception(e.Message);
            }

        }
    }
}
